# Contributor: lauren n. liberda <lauren@selfisekai.rocks>
# Maintainer: lauren n. liberda <lauren@selfisekai.rocks>
pkgname=dart-sass
pkgver=1.69.6
pkgrel=0
pkgdesc="The primary implementation of Sass"
url="https://sass-lang.com/dart-sass"
# armv7: no buf
arch="aarch64 x86_64"	# dart
license="MIT"
depends="dartaotruntime"
makedepends="
	buf
	dart-sdk
	"
_protocol_ver=2.3.0
source="
	https://github.com/sass/dart-sass/archive/refs/tags/$pkgver/dart-sass-$pkgver.tar.gz
	https://github.com/sass/sass/archive/refs/tags/embedded-protocol-$_protocol_ver.tar.gz
	sass

	lock.patch
	"
builddir="$srcdir/dart-sass-$pkgver/"

prepare() {
	mkdir build
	mv "$srcdir/sass-embedded-protocol-$_protocol_ver" build/language

	default_prepare

	dart pub get --enforce-lockfile
}

build() {
	UPDATE_SASS_PROTOCOL=false \
		dart run grinder protobuf
	dart compile aot-snapshot -Dversion="$pkgver" ./bin/sass.dart
}

check() {
	# sanity
	dartaotruntime ./bin/sass.aot --version
}

package() {
	install -Dm644 ./bin/sass.aot "$pkgdir"/usr/lib/dart-sass/sass.aot
	install -Dm755 "$srcdir"/sass "$pkgdir"/usr/bin/sass
}

sha512sums="
8c4eacc73c5ee400d38815827bf9fded5d3c24fa37708c053a2f34f58d976e050095001cef4e89b0f0d0c260acdac017e20eb3480d2a4e3270f335bf43dd6ac8  dart-sass-1.69.6.tar.gz
b70fc72d38eec89a494204f7be4d8f6b6bd0aec2331fcf5b25e7705ce8d6a726c936211bbbb5601d8bd730abc2ed1fdeab7cf5aa850ee72cfaa7f3a7b2ee864f  embedded-protocol-2.3.0.tar.gz
e974b32f3ca9155868282c2259f693b49bd8c8b57772126efa6e29efedcf4acdb2b1359ae0cb5b0552dfd84daa0ae9273ebe90de7f66670a0a6abd75958cac6d  sass
1685247bd07bfeaf2723b9ac84c39da30a78e44ff76810b65a6818b255306fe2d1a6c4a938b40ad8ef2f0ac0bf040f43c4d82e0d29858e34a10f34eecf060a9f  lock.patch
"
